creating frxDBDataSets at runtime
Newbie here. I'm using the demo in EmbedDesigner to build an app to allow another worker here (without much technical ability) the ability to build simple reports.
I'm trying to create a bunch of TfrxDBDataSets and associated TTables on the fly at runtime. The following code is good enough to allow the user to lay out a report with fields from selected tables, but when Preview is attempted an error is thrown:
I'm trying to create a bunch of TfrxDBDataSets and associated TTables on the fly at runtime. The following code is good enough to allow the user to lay out a report with fields from selected tables, but when Preview is attempted an error is thrown:
  if FindFirst('c:\data\*.dbf', faAnyFile, sr) = 0 then
  begin
    repeat
        with TfrxDBDataset.Create(self) do
        begin
        Name:='FRTable' + ChangeFileExt(ExtractFileName(sr.Name),'');
        Dataset:=TTable.Create(self);
        Dataset.Name:='Table' + ChangeFileExt(ExtractFileName(sr.Name),'');
        TTable(Dataset).DatabaseName:='c:\data\';
        TTable(DataSet).TableName:=ChangeFileExt(ExtractFileName(sr.Name),'');
        TTable(DataSet).TableType:=ttDBase;
        UserName:=ChangeFileExt(ExtractFileName(sr.Name),'');
        end;
    until FindNext(sr) <> 0;
    FindClose(sr);
I'm sure its something simple, but as a newbie I don't see it.
Comments